refactor(grid): consistent API for get_cell_vertices#2678
Merged
Conversation
f867c90 to
569d636
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #2678 +/- ##
===========================================
+ Coverage 55.5% 72.7% +17.1%
===========================================
Files 644 667 +23
Lines 124135 129706 +5571
===========================================
+ Hits 68947 94341 +25394
+ Misses 55188 35365 -19823
🚀 New features to boost your workflow:
|
wpbonelli
commented
Jan 8, 2026
| ---------- | ||
| cellid : int or tuple, optional | ||
| Cell identifier. Can be: | ||
| - node number (int) |
Member
Author
There was a problem hiding this comment.
Cell ID and node number are conceptually distinct but up to now the VertexGrid and UnstructuredGrid versions of this method had a single parameter cellid supporting (for vertex) or expecting (for unstructured) a node number. So I think for consistency we can allow passing node number to cellid for StructuredGrid too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously the
Grid.get_cell_vertices()method looked/worked different depending on the grid type. Make it consistent across all three grid types by supporting bothcellidandnodekeyword arguments and being lenient about what's passed tocellidi.e. accept a node number, a fully-sized tuple, or an "abbreviated" tuple lacking layer index. Cell ID and node number are conceptually distinct but til nowVertexGridandUnstructuredGridmethods had a single parametercellidsupporting (for vertex) or expecting (for unstructured) a node number, which we don't want to break. And continue also supportingiandjforStructuredGrid.Noticed these inconsistencies when working on #2677